// 编译命令：gcc -g -o extern_test_multi_files_riscv64.elf *_riscv64.S
.text
.data
.globl test_global_var
// 如果有初始化不为0的数据，放在data里，初始化为0的放在.bss段
test_global_var:
    .long 10

.section .rodata
.align 8
.LC0:
	.string	"in extern_f function of extern.c file, and test_global_var is %d\n"

.text
.globl extern_f
.type extern_f, @function
extern_f:
    addi sp, sp, -16
    sd ra, 8(sp)
    sd s0, 0(sp)

    lui a5, %hi(test_global_var)
    addi a5, a5, %lo(test_global_var)
    lw a1, 0(a5)
    lui a5, %hi(.LC0)
    addi a0, a5, %lo(.LC0)
    call printf

    ld ra, 8(sp)
    ld s0, 0(sp)
    addi sp, sp, 16
    jr ra